package com.dmall.sort.algorithm;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author xiao1.wang
 * @date 2021/10/7 20:30
 */
@SuppressWarnings("all")
public class Application {

    public static void main(String[] args) {
        Sort sort1 = new MergeSort();
        Sort sort2 = new OptimizationMergeSort();
        Sort sort3 = new InsertionMergeSort();
        //Sort sort4 = new QuickSort();
        //Sort sort5 = new RandomQuickSort();
        Sort sort6 = new TwoWaysQuickSort();
        Sort sort7 = new Insertion2WaysQuickSort();
        Sort sort8 = new ThreeWaysQuickSort();
        Sort sort9 = new Insertion3WaysQuickSort();
        Sort sort10 = new HeapSort();
        Sort sort11 = new ShellSort();
        Sort sort12 = new CountingSort();
        Sort sort13 = new Sort() {
            @Override
            public void sort(int[] arr) {
                Arrays.sort(arr);
            }

            @Override
            public String getName() {
                return "Arrays.sort()";
            }
        };

        int[] arr0 = SortHelper.generateRandomArray(1000000, 0, 1000000);
        // int[] arr0 = SortHelper.generateNearlyOrderedArray(1000000, 10);
        // int[] arr0 = SortHelper.generateNearlyReverseOrderedArray(1000000, 0);
        int[] arr1 = Arrays.copyOf(arr0, arr0.length);
        int[] arr2 = Arrays.copyOf(arr0, arr0.length);
        int[] arr3 = Arrays.copyOf(arr0, arr0.length);
        //int[] arr4 = Arrays.copyOf(arr0, arr0.length);
        //int[] arr5 = Arrays.copyOf(arr0, arr0.length);
        int[] arr6 = Arrays.copyOf(arr0, arr0.length);
        int[] arr7 = Arrays.copyOf(arr0, arr0.length);
        int[] arr8 = Arrays.copyOf(arr0, arr0.length);
        int[] arr9 = Arrays.copyOf(arr0, arr0.length);
        int[] arr10 = Arrays.copyOf(arr0, arr0.length);
        int[] arr11 = Arrays.copyOf(arr0, arr0.length);
        int[] arr12 = Arrays.copyOf(arr0, arr0.length);
        int[] arr13 = Arrays.copyOf(arr0, arr0.length);

        SortHelper.testSort(sort1, arr1);
        SortHelper.testSort(sort2, arr2);
        SortHelper.testSort(sort3, arr3);
        //SortHelper.testSort(sort4, arr4);
        //SortHelper.testSort(sort5, arr5);
        SortHelper.testSort(sort6, arr6);
        SortHelper.testSort(sort7, arr7);
        SortHelper.testSort(sort8, arr8);
        SortHelper.testSort(sort9, arr9);
        SortHelper.testSort(sort10, arr10);
        SortHelper.testSort(sort11, arr11);
        SortHelper.testSort(sort12, arr12);
        SortHelper.testSort(sort13, arr13);
    }
}
